package com.timoon.sample.page;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;

import com.googlecode.wicket.jquery.ui.Options;
import com.timoon.component.behavior.bootstrap.AbstractBootStrapBehavior;
import com.timoon.page.Page1;
import com.timoon.sample.service.DiscountServiceImpl;
import com.timoon.sample.utils.SystemConfig;
import com.timoon.webcomponent.utility.info.Info1Panel;
import com.timoon.webcomponent.utility.info.Info1Service;
import com.timoon.webcomponent.utility.navs.nav1.Nav1Panel;
import com.timoon.webcomponent.utility.product.carousel.Carousel1Panel;
import com.timoon.webcomponent.utility.product.discount.Discount1Panel;
import com.timoon.webcomponent.utility.product.discount.Discount1Service;
import com.timoon.webcomponent.utility.product.linepic.HorizontalList4PicProductPanel;
import com.timoon.webcomponent.utility.product.sort.sortnav1.InsideNavsPanel;
import com.timoon.webcomponent.utility.product.sort.sortnav1.InsideNavsService;
import com.timoon.webcomponent.utility.product.sort.sortnav2.Sortnav2Panel;

/**
 *<p></p>
 *<p></p>
 *<p>Copyright:Copyright(c)2013.4.1</p>
 *<p>Company:timoon</p>
 *@author 付乐天
 *@version 1.0 */
public class HomePage extends WebPage {
	
	@SpringBean(name="com.timoon.webcomponent.utility.navs.service.NavsService")
	private InsideNavsService insideNavsService;
	
	@SpringBean(name="com.timoon.sample.service.InfoServiceImpl")
	private Info1Service info1Service;
	
	@SpringBean(name="com.timoon.sample.service.DiscountServiceImpl")
	private Discount1Service discount1Service;

	public HomePage(PageParameters pageParameters) {
		// TODO Auto-generated constructor stub
		
		renderPanel();
	}

	private void renderPanel() {
		// TODO Auto-generated method stub
		
		//引用bootstrap
		this.add(new AbstractBootStrapBehavior("#ddddddd", "click", new Options()));
		
		renderNav();
		
		renderSortNav();
		
		renderPicList();
		
		renderCarousel();
		
		renderInfoReport();
		
		renderDiscount1();
	}

	private void renderDiscount1() {
		// TODO Auto-generated method stub
		add(new Discount1Panel("wk_discount1",discount1Service));
	}

	private void renderInfoReport() {
		// TODO Auto-generated method stub
		add(new Info1Panel("wk_info_report",Page1.class, info1Service));
	}

	private void renderCarousel() {
		// TODO Auto-generated method stub
		add(new Carousel1Panel("wk_carousel"));
	}

	private void renderPicList() {
		// TODO Auto-generated method stub
		add(new HorizontalList4PicProductPanel("wk_pic_4list",5,Page1.class));
	}

	private void renderSortNav() {
		// TODO Auto-generated method stub
		
		add(new Sortnav2Panel("wk_sort_nav",Page1.class,insideNavsService));
	}

	//渲染导航
	private void renderNav() {
		// TODO Auto-generated method stub

		add(new Nav1Panel("wk_main_nav",new SystemConfig().getNav1Parameters()));
	}
}
